Description:
This measure is used as an input to the Halstead Software Science metrics. It counts the number of unique operands used in a class.
Example:
procedure Class1.x(v: boolean);
01 var i,r: Integer;
02 b: Exception;
03 begin
04 if (v) then
05 i := 1
06 else
07 i := 2;
08
09 case i of
10 1:
11 2:
12 else
13 end;
14 try
15 while (v) do begin
16 v := false;
17 r := 1;
18 b := Exception.Create('!!!');
19 i := ((i * i) + r);
20 break
21 end
22 except on e: Exception do
23 raise e
24 end
25 end;
| Line | N1 | n1 | N2 | n2 |
| 04 | if | if | v | v |
| 05 | = | = | i, 1 | i, 1 |
| 07 | = | i, 2 | 2 | |
| 09 | switch | switch | i | |
| 15 | loop | loop | v | |
| 16 | = | v, false | false | |
| 17 | = | 1 | ||
| 18 | =, new, call | new, call | Exception, "!!!" | Exception, "!!!" |
| 19 | =, *, + | *, + | i, i, i, r | r |
| 23 | throw | throw | e | e |
| Total | 14 | 9 | 17 | 9 |
Where